#ifndef JOBQUEUE_H
#define JOBQUEUE_H

#include <pthread.h>
#include <queue>
#include "job.h"

class JobQueue {
	public:
		JobQueue();
		~JobQueue();
		void push(Job *job);
		Job *pop();
		void reset();
		void jobCompleted();
		float getCompletion();
		bool isCompleted();
	private:
		volatile int nCompleted_;
		volatile int nTotal_;
		std::queue<Job *> queue_;
		pthread_mutex_t queueMutex_;
		pthread_mutex_t nCompletedMutex_;
		pthread_mutex_t nTotalMutex_;
};

#endif
